15063896461e734ee81e32d9b8face521d6cf1ea,errai-ui/src/main/java/org/jboss/errai/ui/rebind/ElementProviderExtension.java,ElementProviderExtension,typeHasValueWithOverlayMethods,#MetaClass#,179

Before Change



  private static boolean typeHasValueWithOverlayMethods(final MetaClass type) {
    final MetaMethod getValue;
    return type.isAssignableTo(HasValue.class)
            && ((getValue = type.getMethod("getValue", new Class[0])).isAnnotationPresent(JsOverlay.class)
                    || type.getMethod("setValue", getValue.getReturnType()).isAnnotationPresent(JsOverlay.class));
  }

After Change


   * an invocation so the GWT compiler uses the correct JS invocation at runtime.
   */
  private static boolean implementsNativeHasValueAndRequiresGeneratedInvocation(final MetaClass type) {
    if (type.isAssignableTo(HasValue.class)) {
      final Optional<MetaMethod> oGetValue = Optional.of(type.getMethod("getValue", new MetaClass[0]));
      final Optional<MetaMethod> oSetValue = oGetValue
              .flatMap(m -> Optional.of(m.getReturnType()))
              .flatMap(retType -> Optional.of(type.getMethod("setValue", retType)));


      if (!oGetValue.isPresent() || !oSetValue.isPresent()) {
        /*
         * In this case, the methods could be default implementations on an interface (not retunred by TypeOracle) so we
         * will assume we need to generate an invocation.
         */
        return true;
      }
      else {
        final Stream<Annotation> getAnnos = oGetValue.map(m -> Arrays.stream(m.getAnnotations())).orElseGet(Stream::empty);
        final Stream<Annotation> setAnnos = oSetValue.map(m -> Arrays.stream(m.getAnnotations())).orElseGet(Stream::empty);

        final Predicate<Annotation> testForOverlayOrProperty = anno -> anno.annotationType().equals(JsProperty.class)
                || anno.annotationType().equals(JsOverlay.class);

        return getAnnos.anyMatch(testForOverlayOrProperty) || setAnnos.anyMatch(testForOverlayOrProperty);
      }
    }

    return false;
  }

  private static Object createAccessorImpl(final MetaClass type, final String varName) {